s= input()
t=input()
w=0
while True:
i = len(s) - w - 1
j = len(t)-w-1
if i>=0 and j>=0 and t[j]==s[i]:
w += 1
else:
break
print(len(s)+len(t)-2*w)
#include<iostream>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<iomanip>
#include<map>
#include<set>
#include<bitset>
#define ll long long
#define T int t; cin>>t; while(t--)
#define pb push_back
#define vv vector
#define ss string
#define so(vec) sort(vec.begin(), vec.end())
#define srt(vec) sort(vec.rbegin(), vec.rend())
#define s(s) sort(s.begin(), s.end())
#define all(vec) vec.begin(), vec.end()
#define sor(arr,n) sort(arr, arr+n)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define Mod 1000000007
const double PI = 3.14159265358979323846;
using namespace std;
void HaiDO0da() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
}
int main()
{
HaiDO0da();
ss x,y; cin>>x >>y;
int cnt=0,b=x.size()+y.size(),c=min(x.size(),y.size());
reverse(x.begin(),x.end());
reverse(y.begin(),y.end());
for(int i=0;i<c;i++){
if(x[i]==y[i]) cnt++;
else break;
}
//cout<<cnt;
cout<<b-(cnt*2);
}
1475E - Advertising Agency | 1345B - Card Constructions |
1077B - Disturbed People | 653A - Bear and Three Balls |
794A - Bank Robbery | 157A - Game Outcome |
3B - Lorry | 1392A - Omkar and Password |
489A - SwapSort | 932A - Palindromic Supersequence |
433A - Kitahara Haruki's Gift | 672A - Summer Camp |
1277A - Happy Birthday Polycarp | 577A - Multiplication Table |
817C - Really Big Numbers | 1355A - Sequence with Digits |
977B - Two-gram | 993A - Two Squares |
1659D - Reverse Sort Sum | 1659A - Red Versus Blue |
1659B - Bit Flipping | 1480B - The Great Hero |
1519B - The Cake Is a Lie | 1659C - Line Empire |
515A - Drazil and Date | 1084B - Kvass and the Fair Nut |
1101A - Minimum Integer | 985D - Sand Fortress |
1279A - New Year Garland | 1279B - Verse For Santa |